package com.example.hudongwx.myclass0719application;

import android.support.v4.app.FragmentTabHost;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TabHost;
import android.widget.TabWidget;

import com.example.hudongwx.myclass0719application.fragment.FragGoWuChe;
import com.example.hudongwx.myclass0719application.fragment.FragJuZan;
import com.example.hudongwx.myclass0719application.fragment.FragJuZan1;
import com.example.hudongwx.myclass0719application.fragment.FragShanJiang;
import com.example.hudongwx.myclass0719application.fragment.FragWoDe;
import com.example.hudongwx.myclass0719application.fragment.FragYuRe;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;


@ContentView(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {
    @ViewInject(android.R.id.tabhost)
 private FragmentTabHost fragmentTabHost;
    @ViewInject(android.R.id.tabs)
 private    TabWidget  tabWidget;
    @ViewInject(android.R.id.tabcontent)
  private   FrameLayout frameLayout;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
//调用底部菜单方法
        bottomView();


    }

    /**
     * 底部菜单写成一个方法
     */
    private  void  bottomView(){
         fragmentTabHost.setup(this,getSupportFragmentManager(),android.R.id.tabcontent);

        View view1 = getLayoutInflater().inflate(R.layout.select_shanjiang, null);
        TabHost.TabSpec tabSpec1 = fragmentTabHost.newTabSpec("shanjiang").setIndicator(view1);
        fragmentTabHost.addTab(tabSpec1, FragShanJiang.class,null);

        View view2 = getLayoutInflater().inflate(R.layout.select_yure, null);
        TabHost.TabSpec tabSpec2 = fragmentTabHost.newTabSpec("yure").setIndicator(view2);
        fragmentTabHost.addTab(tabSpec2, FragYuRe.class,null);

        View view3 = getLayoutInflater().inflate(R.layout.select_juzan, null);
        TabHost.TabSpec tabSpec3 = fragmentTabHost.newTabSpec("juzan").setIndicator(view3);
        fragmentTabHost.addTab(tabSpec3, FragJuZan1.class,null);

        View view4 = getLayoutInflater().inflate(R.layout.select_gowuche, null);
        TabHost.TabSpec tabSpec4 = fragmentTabHost.newTabSpec("gouwuche").setIndicator(view4);
        fragmentTabHost.addTab(tabSpec4, FragGoWuChe.class,null);

        View view5 = getLayoutInflater().inflate(R.layout.select_wode, null);
        TabHost.TabSpec tabSpec5 = fragmentTabHost.newTabSpec("wode").setIndicator(view5);
        fragmentTabHost.addTab(tabSpec5, FragWoDe.class,null);



    }



}
